package com.itita.ww2.model.item;

import com.itita.ww2.model.item.enums.ItemPrimaryType;
import com.smartfoxserver.v2.entities.data.ISFSObject;
import com.smartfoxserver.v2.entities.data.SFSObject;

/**
 * 物品数据抽象模型
 * @author NorthLan
 *
 */
public abstract class AbstractItem {
	protected String uuid; // 唯一ID
	protected String itemId; // 道具id编号
	protected int param1;
	protected int param2;
	protected boolean useable;
	protected int effParam;
	// 
	protected boolean compositable; // 可合成
	protected transient ItemPrimaryType primaryType; // 道具种类(大类)

	public AbstractItem(String itemId, int param1, int param2, boolean useable, int effParam) {
		this.primaryType = ItemPrimaryType.idValueOf(itemId);
		this.itemId = itemId;
		this.param1 = param1;
		this.param2 = param2;
		this.useable = useable;
		this.effParam = effParam;
		this.compositable = false;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public String getItemId() {
		return itemId;
	}

	public int getParam1() {
		return param1;
	}

	public int getParam2() {
		return param2;
	}

	public boolean isUseable() {
		return useable;
	}

	public int getEffParam() {
		return effParam;
	}

	public ItemPrimaryType getPrimaryType() {
		return primaryType;
	}

	public boolean isCompositable() {
		return compositable;
	}

	public ISFSObject toSFSObject() {
		ISFSObject ref = SFSObject.newInstance();
		ref.putUtfString("uuid", this.uuid);
		ref.putUtfString("itemId", itemId);
		return ref;
	}

	public abstract boolean canStack();
}
